// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';
import { API_BASE_URL } from '../../config/proxy';

// 登录接口 POST /api/sysAuth/login
export async function login(body: any, options?: { [key: string]: any }) {
  return request<API.LoginResult>(`${API_BASE_URL}/api/sysAuth/login`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

// 获取当前的用户 GET /api/sysAuth/userInfo
export async function currentUser(options?: { [key: string]: any }) {
  return request<{
    data: API.CurrentUser;
  }>(`${API_BASE_URL}/api/sysAuth/userInfo`, {
    method: 'GET',
    ...(options || {}),
  });
}

// 退出登录接口 POST /api/sysAuth/logout
export async function outLogin(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_BASE_URL}/api/sysAuth/logout`, {
    method: 'POST',
    ...(options || {}),
  });
}

// 获取验证码 GET /api/sysAuth/captcha
export async function getCaptcha(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_BASE_URL}/api/sysAuth/captcha`, {
    method: 'GET',
    ...(options || {}),
  });
}

// 加载系统信息和SM2公钥 GET /api/sysConfig/sysInfo
export async function getSysInfo(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_BASE_URL}/api/sysConfig/sysInfo`, {
    method: 'GET',
    ...(options || {}),
  });
}

// 获取登录菜单树 GET /api/sysMenu/loginMenuTree
export async function getLoginMenuTree(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_BASE_URL}/api/sysMenu/loginMenuTree`, {
    method: 'GET',
    ...(options || {}),
  });
}